import 'package:get/get_rx/src/rx_types/rx_types.dart';
import 'package:xreader/base/viewmodel/base_view_model.dart';
import 'package:xreader/logs/log.dart';
import 'package:xreader/novel/entity/entity_novel_book_info.dart';
import 'package:xreader/novel/model/novel_content_model.dart';

enum ReaderTurnPageMode { normalMode,coverMode,simulationMode}

class NovelContentChapterViewModel extends BaseViewModel<NovelChapterContentModel>{

  int chapterIndex = 0;
  final int chapterId;
  final int bookid;
  var currentNovelInfo = Rx<NovelBookDetailInfo?>(null);
  ReaderTurnPageMode currentTurnMode = ReaderTurnPageMode.normalMode;
  NovelContentChapterViewModel(this.bookid,this.chapterId,{required NovelChapterContentModel contentParseerModel})
  :super(model: contentParseerModel);

  @override
  void onReady() {
    Log.i("====>get Controller is onReady");
    super.onReady();

    NovelBookDetailInfo detailInfo = NovelBookDetailInfo();
    detailInfo.bookAuthor = "DDD";
    detailInfo.bookTitle = "书籍---";
    detailInfo.detailUrl = "ddd";
    detailInfo.lastChapterTitle = "的就是看电视";
    detailInfo.chapterList = [];
    NovelChapterInfo testChapterA = NovelChapterInfo();
    testChapterA.chapterId = 1000;
    testChapterA.chapterTitle = "卧槽";
    testChapterA.chapterPageContentList = [];
    detailInfo.chapterList?.add(testChapterA);
    currentNovelInfo.value = detailInfo;

    model?.init();
    refresh();//刷新
  }
  void changeTurnMode(ReaderTurnPageMode mode){
    currentTurnMode = mode;
    refresh();
  }


}